<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/custom.form.css">
    <style>
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-header{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-main{
            overflow: visible;
        }
    </style>
</head>
<body>
<div class="cqyj_table_div">
    <form class="layui-form" method="post">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input type="text" id="nsrsbh" class="layui-input" autocomplete="off" placeholder="请输纳税人识别号">
            </div>

            <div class="layui-input-inline">
                <input type="text" id="nsrmc" class="layui-input" autocomplete="off" placeholder="请输入企业名称">
            </div>

            <div class="layui-input-inline" style="margin-top: 8px">
<!--                <button class="layui-btn" onclick="search()" id="search">查询</button>-->
                <button type="button" class="layui-btn" lay-submit="" lay-filter="demo">查询</button>
            </div>


    </div>
    <table class="layui-hide" id="ajcx_table" lay-filter="ajcx_table"></table>
    </form>
</div>

</body>

<script src="/layui/layui.all.js"></script>
<script src="/layui-ext/selectM/selectM.js"></script>
<script src="/js/core.util.js"></script>
<script language="JavaScript" src="/newmain/js/bizjs/gy.js"></script>
<script>
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var ajztDms;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    var tree = layui.tree;
    var la_startTime = null;
    var la_endTime = null;
    var zxwb_startTime = null;
    var zxwb_endTime = null;
    var ja_startTime = null;
    var ja_endTime = null;
    var selectMAjcx = layui.selectM;

    layui.config({
        base: '/'
    }).extend({
        eleTree: 'layui-ext/eleTree/eleTree',
        selectM: 'layui-ext/selectM/selectM'
    }).use(['table', 'laypage', 'layer', 'laydate', 'tree', 'eleTree'], function () {
        tableIns1 = table.render({
            elem: '#ajcx_table'
            , loading: false
            , page: true //开启分页
            , cols: [
                [
                    {field: 'resname', title: '保存结果名称',width:200},
                    {field: 'djxh', title: '登记序号',width:200},
                    {field: 'nsrsbh', title: '纳税人识别号',width:200},
                    {field: 'nsrmc', title: '纳税人名称',width:200},
                    {field: 'shxydm', title: '社会信用代码',width:200},
                    {field: 'createTime', title: '数据生成时间',width:200},
                    {field: 'lrrDm', title: '数据生成人',width:200}
                ]
            ]
            // , toolbar: '#toolbar'
        });
        form.on('submit(demo)',function(data){
            var formData = data.field;
            var ajztDms = formData.ajztDm;
            var whereParams = {
                "nsrsbh":$("#nsrsbh").val(),
                "nsrmc":$("#nsrmc").val(),
            };
            tableIns1.reload({
                contentType: 'application/json'
                , headers: {"authorization": token}
                ,where :whereParams
                , url: '/attention/zbxansrcx' //数据接口
                , method: 'POST'
                , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                        "data": CoreUtil.isEmpty(res.data) ? null : res.data.records //解析数据列表
                    }
                }, page: {
                    curr: 1 //重新从第 1 页开始
                }
            },false);
        })
    });

    //执行查询
    function search() {
        var whereParams = {
           "nsrsbh":$("#nsrsbh").val(),
           "nsrmc":$("#nsrmc").val(),
           "ajbh":$("#ajbh").val(),
           "lastartTime":la_startTime,
           "laendTime":la_endTime,
           "zxwbstartTime":zxwb_startTime,
           "zxwbendTime":zxwb_endTime,
           "jastartTime":ja_startTime,
           "jaendTime":ja_endTime,
           "ajztDms":ajztDms.values
        };
        tableIns1.reload({
            contentType: 'application/json'
            , headers: {"authorization": token}
            ,where :whereParams
            , url: '/attention/attentionMgr/ajcx' //数据接口
            , method: 'POST'
            , page: {
                curr: 1 //重新从第 1 页开始
            }
        },false);
    }
    function getCurrentDay(){
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        month = (month > 9) ? month : ("0" + month);
        day = (day < 10) ? ("0" + day) : day;
        var today = year + "-" + month + "-" + day;
        return today;
    }
</script>
</html>